<template>
    <view v-html="notice.content" class="content"></view>
</template>

<script>
import { get } from '@/cms/api/notice/notice'
import { unescape } from '@/common/js/richText'
import { replaceImg } from '@/common/js/url'

export default {
    data() {
        return {
            id: 0,
            notice: {}
        }
    },
    onLoad(options) {
        this.id = options.id
        this.fetchData()
    },
    methods: {
        fetchData() {
            get({
                id: this.id
            }).then(res => {
                res.data.content = replaceImg(res.data.content)
                res.data.content = unescape(res.data.content)
                this.notice = res.data
                uni.setNavigationBarTitle({
                    title: this.notice.title
                })
            })
        }
    }
}
</script>

<style lang="scss" scoped>
.content {
    padding: 10px;
    background-color: white;
}
</style>

